﻿<%@ Page Language="C#" EnableViewState="false" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="Forum.Web.Admin.Ad.Default" %>

<%@ Register Assembly="Public.Control" Namespace="Public.Control" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../styles/dntmanager.css" rel="stylesheet" type="text/css" />
    <link href="../styles/modelpopup.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
<!--
#td_l {
	border-right-width: 1px;
	border-left-width: 1px;
	border-right-style: dashed;
	border-left-style: dashed;
	border-right-color: #CCCCCC;
	border-left-color: #CCCCCC;
}
body, td {
	line-height: 20px;
}
.STYLE1 {color: #FF0000}
.MainDiv .FormBase,.MainDiv .FormFocus
{
line-height:20px;
}
-->
    </style>
</head>
<script src="../js/public.js" type="text/javascript"></script>
<script src="../js/common.js" type="text/javascript"></script>
<script src="../js/modalpopup.js" type="text/javascript"></script>
<script src="../js/jquery/jquery.js" type="text/javascript"></script>
<body>
    <cc1:Hint ID="Hint" runat="server" HintImageUrl="../images" />
    <form id="form2" runat="server">
    <div class="ManagerForm">
        <fieldset>
            <legend style="background: url(../images/icons/icon49.jpg) no-repeat 6px 50%;">首页广告管理</legend>
            <div class="MainDiv">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="70" height="40">
                            广告提示:
                        </td>
                        <td style="padding-left: 50px;">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
                            &nbsp;(提示:以下广告均支持HTML代码,只有<span class="STYLE1">被启用</span>的广告才能显示在广告上<br>
                            广告代码使用方法：只要在页面模板里嵌入：<cc1:TextBox ID="f_name0" runat="server" Text="{WebBase.GetAdHtml(1)}"
                                Style="border: 0px; color: red" Width="160px"></cc1:TextBox>就可以显示第1个广告,括号里的1表示第1个广告<br />
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td height="40" colspan="2">
                            <table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#CCCCCC">
                                <tr bgcolor="#f1f1f1">
                                    <td width="100" height="35">
                                        编号
                                    </td>
                                    <td width="80">
                                        是否启用
                                    </td>
                                    <td>
                                        广告代码
                                    </td>
                                    <td width="120">
                                        操作
                                    </td>
                                </tr>
                                <asp:Repeater ID="Repeater1" runat="server">
                                    <ItemTemplate>
                                        <tr>
                                            <td height="75" bgcolor="#FFFFFF">
                                                <cc1:TextBox ID="ad_id" runat="server" Text='<%#Eval("id") %>' ReadOnly="true" Width="60"></cc1:TextBox>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <img src="../images/is<%#Eval("isapproved") %>.gif" width="16" height="16" />
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <textarea id='ad_txt<%#Eval("ID") %>' rows="2" cols="20" class="txt" class="FormBase"
                                                    style="height: 60px; width: 96%;"><%#Eval("adtxt") %></textarea>
                                            </td>
                                            <td bgcolor="#FFFFFF">
                                                <a href="javascript:showbox(<%#Eval("ID") %>,<%#Eval("isapproved") %>);">
                                                    <img alt="编辑此信息" src="../images/icon_edit.gif" /></a> &nbsp;&nbsp;&nbsp; <a href="javascript:del_date(<%#Eval("ID") %>)">
                                                        <img alt="删除此信息" src="../images/icon_del.gif" /></a>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
        </fieldset>
        <div class="Navbutton">
            <cc1:Button ID="Button2" runat="server" ButtonImgUrl="../images/add.gif" Text=" 新增广告"
                AutoPostBack="False" ScriptContent="add_edit_id = -1;showbox(-1,1)" />
            <cc1:Button ID="Button6" runat="server" ButtonImgUrl="../images/del.gif" Text=" 删 除"
                AutoPostBack="False" HintInfo="删除所选择的友情链接" ScriptContent="update_()" />
        </div>
    </div>
    <script type="text/javascript">
        var add_edit_id = -1; //-1表示添加


        function showbox(add_edit, istf) {
            add_edit_id = add_edit;
            _istf = istf;
            if (add_edit_id != -1) {
                $("#adtxt").val($("#ad_txt" + add_edit_id).val());
                $("#Checkbox1").attr("checked", istf == 1);
            }

            BOX_show("neworedit");

            //showmodel();
        }

        function onsub__() {
            //SaveAd(int id, int isapproved, string adtxt)
            Forum.Web.Admin.Ad.Default.SaveAd(add_edit_id, $("#Checkbox1").attr("checked") == true ? 1 : 0, $("#adtxt").val(), function (res) {
                if (res.value == 1) {
                    document.location.reload();
                }
            });
        }

        function del_date(id_) {
            var msg = window.confirm("您确定要删除吗");
            if (msg) {
                Forum.Web.Admin.Ad.Default.DelAd(id_, function (res) {
                    if (res.value == 1) {
                        document.location.reload();
                    }
                });
            }
        }

    </script>
    <div id="neworedit" style="border-right: #999 1px solid; padding-right: 10px; border-top: #999 1px solid;
        display:none ; padding-left: 10px; background: #fff; padding-bottom: 10px; border-left: #999 1px solid;
        width: 500px; padding-top: 10px; border-bottom: #999 1px solid">
        <div class="ManagerForm">
            <fieldset>
                <legend style="background: url(../images/icons/icon4.jpg) no-repeat 6px 50%">添加广告代码</legend>
                <div>
                    <table width="417" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="80" height="35">
                                广告代码:
                            </td>
                            <td>
                                <cc1:TextBox ID="adtxt" runat="server" Width="320px" Height="80px" TextMode="MultiLine"></cc1:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td height="35">
                                是否启用:
                            </td>
                            <td>
                                <input id="Checkbox1" type="checkbox" /><label for="Checkbox1">启用后广告代码才生效</label>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <cc1:Button ID="Button3" runat="server" ButtonImgUrl="../images/add.gif" Text=" 提 交"
                                    AutoPostBack="False" ScriptContent="onsub__()" />
                                <cc1:Button ID="Button4" runat="server" ButtonImgUrl="../images/del.gif" Text=" 取 消"
                                    AutoPostBack="False" ScriptContent="BOX_remove('neworedit');" />
                            </td>
                        </tr>
                    </table>
                </div>
            </fieldset>
        </div>
    </div>
    </form>
</body>
</html>
